import {DbStorage, DbAsyncStorage, Application} from "@/module/storage/types";
import Constant from "@/global/Constant";
import PluginModeEnum from "@/enumeration/PluginModeEnum";
import {applicationForUtools, dbAsyncStorageForUtools, dbStorageForUtools} from "@/module/storage/driver/utools";
import {applicationForCommon, dbAsyncStorageForCommon, dbStorageForCommon} from "@/module/storage/driver/common";

export const dbStorage: DbStorage = (() => {
  if (Constant.mode === PluginModeEnum.UTOOLS) {
    return dbStorageForUtools
  }
  return dbStorageForCommon;
})();
export const dbAsyncStorage: DbAsyncStorage = (() => {
  if (Constant.mode === PluginModeEnum.UTOOLS) {
    return dbAsyncStorageForUtools
  }
  return dbAsyncStorageForCommon;
})();
export const app: Application = (() => {
  if (Constant.mode === PluginModeEnum.UTOOLS) {
    return applicationForUtools;
  }
  return applicationForCommon;
})();